//
//  HMBillViewController.m
//  HMSupplier
//
//  Created by haohao on 2017/7/6.
//  Copyright © 2017年 haohao. All rights reserved.
//

#import "HMBillViewController.h"
#import "OrderRecondTableViewCell.h"
@interface HMBillViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *myTableView;

@end

@implementation HMBillViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setSubView];
    // Do any additional setup after loading the view from its nib.
}

- (void)setSubView {
    self.title = @"账单记录";
    _myTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KWidthSCREEN, KHeightSCREEN) style:UITableViewStyleGrouped];
    _myTableView.delegate = self;
    _myTableView.dataSource = self;
    [self.view addSubview:_myTableView];
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    OrderRecondTableViewCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"OrderRecondTableViewCell" owner:self options:nil] firstObject];
    return cell;
}

#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 70;
}

- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *headerVC = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KWidthSCREEN, 36)];
    UILabel *dayLabel = [[UILabel alloc] initWithFrame:CGRectMake(36, 0, KWidthSCREEN - 36, 36)];
    dayLabel.text = @"本月";
    [headerVC addSubview:dayLabel];
    return headerVC;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 36;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.0001;
}

-(void)viewDidLayoutSubviews
{
    if ([self.myTableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [self.myTableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
    }
    
    if ([self.myTableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [self.myTableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
